class Solution14 {
    public int sum;
    public int path;
    public int subsetXORSum(int[] nums) {
        dfs(nums,0);
        return sum;
    }

    public void dfs(int[] nums,int pos) {
        sum += path;
        for(int i = pos; i < nums.length; i++) {
            path = path ^ nums[i];
            dfs(nums,i+1);
            path = path ^ nums[i];
        }
    }
}